<template>
	<view>
		<view class="box">
			<view class="titlebox">订单类型</view>
			<view class="listbox">
				<!-- //rule_type==2商家 rule_type==1供应商 -->
				<view class="itemlist" style="width: 25%;" v-if="myinfo.rule_type==2" v-for="(item,index) in list.slice(0,4)" :key="index" @click="toorder(index)">
						<image :src="item.img"></image>
						<view class="namebox">{{item.title}}</view>
						<!-- 1 供应商订单  2到店支付订单  3外卖订单 4自提订单 5团购订单 -->
						<view>{{index==0?treenum:index==1?twonum:index==2?fournum:index==3?fivenum:onenum}}单</view>
				</view>
				<!--  v-if="myinfo.rule_type==1" -->
				<view class="itemlist"  style="width: 25%;margin-top: 20rpx;" v-for="(item,index) in list.slice(4,5)" :key="index" @click="toorderorther(index)">
						<image :src="item.img"></image>
						<view class="namebox">{{item.title}}</view>
						<view>{{onenum}}单</view>
				</view>
			</view>
		</view>
		<adminBottomTab></adminBottomTab>
	</view>
</template>

<script>
	import adminBottomTab from "../../components/admin-bottom-tab.vue"
	export default {
		components: { adminBottomTab },
		data() {
			return {
				list:[{img:'../../static/admin1.png',title:'外卖订单'},
				{img:'../../static/admin2.png',title:'到店订单'},
				{img:'../../static/admin3.png',title:'自提订单'},
				{img:'../../static/admin5.png',title:'团购订单'},
				{img:'../../static/admin4.png',title:'商城订单'}],
				myinfo:{},
				onenum:'',
				twonum:'',
				treenum:'',
				fournum:'',
				fivenum:'',
			}
		},
		onShow() {
			this.getmyinfo()
			this.getnum()
		},
		methods: {
			getmyinfo(){
				this.$http({
					url:'api/Wechat/userinfo'
				}).then(res=>{
					this.myinfo = res.data//rule_type==2商家 rule_type==1供应商
				})
			},
			getnum(){
				this.$http({
					url:'api/merch/orderCountStatistics',
				}).then(res=>{
					//1 供应商订单  2到店支付订单  3外卖订单 4自提订单 5团购订单
					this.onenum = res.data.count1
					this.twonum = res.data.count2
					this.treenum = res.data.count3
					this.fournum = res.data.count4
					this.fivenum = res.data.count5
				})
			},
			toorder(index){
				if(index==0){
					uni.navigateTo({
						url:'/admin/takeawayorder/takeawayorder?order_type='+3
					})
				}
				if(index==1){
					uni.navigateTo({
						url:'/admin/scenestoreorder/scenestoreorder?order_type='+2
					})
				}if(index==2){
					uni.navigateTo({
						url:'/admin/selfpick/selfpick?order_type='+4
					})
				}if(index==3){
					uni.navigateTo({
						url:'/admin/groupbuying/groupbuying?order_type='+5
					})
				}
			},
			toorderorther(){
				uni.navigateTo({
					url:'/admin/order/order?order_type='+1
				})
			}
		}
	}
</script>

<style>
	page{
		background-color: #F7F7F7;
	}
</style>
<style lang="scss" scoped>
	.box{
		width: 690rpx;
		// height: 434rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin: 20rpx auto;
		padding: 30rpx 0;
		.titlebox{
			width: fit-content;
			margin-left: 26rpx;
			background: linear-gradient(360deg, #FFEBE7 0%, #FFFFFF 30%);
			font-size: 36rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #222222;
		}
		.listbox{
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			margin-top: 24rpx;
			.itemlist{
				width: 100%;
				text-align: center;
				font-size: 26rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #555555;
				.namebox{
					font-size: 28rpx;
					font-family: Source Han Sans CN-Regular, Source Han Sans CN;
					font-weight: 400;
					color: #222222;
					margin: 20rpx 0 10rpx 0;
				}
				image{
					width: 132rpx;
					height: 130rpx;
				}
			}
		}
	}

</style>
